#include "initialnode.h"
#include <QPainter>

InitialNodeShape *InitialNodeShape::clone() const
{
	InitialNodeShape *newshape = new InitialNodeShape();
	newshape->setPos(this->pos());
	return newshape;
}

InitialNodeShape::InitialNodeShape (QGraphicsItem *parent)
	: Shape(parent)
{
}

InitialNodeShape::InitialNodeShape (const QPointF &pos, QGraphicsItem *parent)
	: Shape(parent)
{
	setPos(pos);
}

QRectF InitialNodeShape::boundingRect() const
{
	return QRectF(QPoint(-RADIUS,-RADIUS), QPoint(RADIUS, RADIUS))
			.adjusted(-5,-5,5,5);
}

void InitialNodeShape::paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
	painter->setPen(Qt::black);
	painter->setBrush(Qt::black);
	painter->drawEllipse(QPoint(0,0), RADIUS,RADIUS);

	if (InitialNodeShape::isSelected())
	{
		InitialNodeShape::setPenAndBrushForSelection(painter);
		painter->drawEllipse(QPoint(0,0), RADIUS-3,RADIUS-3);
	}
}

QPainterPath InitialNodeShape::shape() const
{
	QPainterPath path;
	path.addEllipse(QPointF(0,0), RADIUS,RADIUS);
	return path;
}
